#ifndef TRACKING_SYSTEM_H_
#define TRACKING_SYSTEM_H_
#define NOMINMAX
#include <string>
#include <vector>

#include <ARToolKitPlus/TrackerMultiMarker.h>
#include <ARToolKitPlus/ar.h>

#include "trackerobject.h"


class TrackingSystem
{
public:
	TrackingSystem();
	virtual ~TrackingSystem();

	void Init(int width, int height);

	int Update(const unsigned char* data); //return true if pose is computed

	float GetMarkerDepth(ARToolKitPlus::ARMarkerInfo* markerInfo, TrackerObject* obj);

	float GetMarkerDepthCont(ARToolKitPlus::ARMarkerInfo* markerInfo, TrackerObject* obj);


	ARToolKitPlus::TrackerMultiMarker* GetTracker()
	{
		return mTracker;
	}



	float* Convert(const ARFloat _trans[3][4]) const;

	const std::vector<int> GetVisibleMarkersId() const;
	const ARToolKitPlus::ARMarkerInfo& GetDetectedMarker(int nWhich) const;
	bool IsMarkerFound() const { return mMarkersFound; }
	void SetMarkerFound(bool _isFound) { mMarkersFound = _isFound; }
	int GetNumDetected() const { return mNumDetected; }
	
	static std::string sConfigFilename;
	static std::string sCalibrationFilename;	
	static bool sIsUsingFullResImage;
	static bool sIsUsingHistory;
	static bool sIsUsingAutoThreshold;
	static int sThreshold;

protected:
	ARToolKitPlus::TrackerMultiMarker *mTracker;

	bool mMarkersFound;
	bool mInitialized;
	int mNumDetected;

};


#endif // TRACKING_SYSTEM_H_